ValueFolder='Full path to where this file DonneesNature.xlsx is stored';
ValueFolder3='Full path to where this file FileAnalysisCharacteristicsEditorsJournalXX.mat is stored';
[VecValueTemp,VecValueTemp2]=xlsread([ValueFolder 'DonneesNature.xlsx'],3);
VecValueJournal=VecValueTemp;
n3=9;
VecResults1=[];
VecResults2=[];
VecResults3=[];
VecResults4=[];
VecResults5=[];
VecResults6=[];
VecResults7=[];
VecResults12=[];
VecResults22=[];
VecResultsTemp4=[];
VecResultsTemp5=[];
for n4=2:size(VecValueTemp2,1)
    ValueTemp=VecValueTemp2{n4,6};
    if strcmp(ValueTemp,'Yes')==1
        n2=VecValueJournal(n4-1,3);
        n2Temp=n2;
        load([ValueFolder3 'FileAnalysisCharacteristicsEditorsJournal' num2str(n2) '.mat']);
        ValueTemp=VecValueTemp2{n4,n3};
        ValueTemp2=VecValueTemp2{n4,n3-1};
        ValueTemp3=VecValueTemp2{n4,n3+3};
        ValueTemp4=VecValueTemp2{n4,n3+2};
        if strcmp(ValueTemp2,'Yes')==1||strcmp(ValueTemp4,'Yes')==1
            VecResults1=[VecResults1;VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,27) VecResultsJournalEditor(1,1) n2Temp];
            if strcmp(ValueTemp4,'Yes')==1
                VecResults3=[VecResults3;1 VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,39) VecResultsJournalEditor(1,1)+VecResultsJournalEditor(1,2) VecResultsJournalEditor(1,27) VecResultsJournalEditor(1,40)];
            else
                VecResults3=[VecResults3;2 VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,39) VecResultsJournalEditor(1,1)+VecResultsJournalEditor(1,2) VecResultsJournalEditor(1,27) VecResultsJournalEditor(1,40)];
            end
        else
            VecResults2=[VecResults2;VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,27) VecResultsJournalEditor(1,1) n2Temp];
            if strcmp(ValueTemp4,'Yes')==1
                VecResults3=[VecResults3;3 VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,39) VecResultsJournalEditor(1,1)+VecResultsJournalEditor(1,2) VecResultsJournalEditor(1,27) VecResultsJournalEditor(1,40)];
            else
                VecResults3=[VecResults3;4 VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,39) VecResultsJournalEditor(1,1)+VecResultsJournalEditor(1,2) VecResultsJournalEditor(1,27) VecResultsJournalEditor(1,40)];
            end
        end
        if strcmp(ValueTemp2,'Yes')==1&&strcmp(ValueTemp4,'Yes')==1
            VecResults5=[VecResults5;VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,40) VecResultsJournalEditor(1,1)+VecResultsJournalEditor(1,2)];
        end
        if strcmp(ValueTemp,'Yes')==1||strcmp(ValueTemp3,'Yes')==1||strcmp(ValueTemp2,'No')==1
            VecResults6=[VecResults6;VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,40) VecResultsJournalEditor(1,1)+VecResultsJournalEditor(1,2)];
        end
        ValueTemp=VecValueTemp2{n4,20};
        if strcmp(ValueTemp,'Yes')==1
            VecResults7=[VecResults7;1 n2Temp];
        else
            VecResults7=[VecResults7;0 n2Temp];
        end
        load([ValueFolder3 'FileAnalysisCharacteristicsEditorsResearchJournal' num2str(n2Temp) '.mat']);
        ValueTemp2=VecValueTemp2{n4,n3-1};
        ValueTemp4=VecValueTemp2{n4,n3+2};
        if strcmp(ValueTemp2,'Yes')==1||strcmp(ValueTemp4,'Yes')==1
            VecResults12=[VecResults12;VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,27) VecResultsJournalEditor(1,1) n2Temp];
        else
            VecResults22=[VecResults22;VecResultsJournalEditor(1,16) VecResultsJournalEditor(1,27) VecResultsJournalEditor(1,1) n2Temp];
        end
    end
end
ValueTemp=find(isnan(VecResults1(:,1))==0);
ValueTemp2=find(isnan(VecResults2(:,1))==0);
ValueTemp5=find(isnan(VecResults12(:,1))==0);
ValueTemp6=find(isnan(VecResults22(:,1))==0);
[ValueTemp3,ValueTemp4]=ttest2(VecResults1(ValueTemp,1),VecResults2(ValueTemp2,1));
[ValueTemp3Temp,ValueTemp4Temp]=ranksum(VecResults1(ValueTemp,1),VecResults2(ValueTemp2,1));
VecResultsTemp4=[VecResultsTemp4;median(VecResults1(ValueTemp,1)) quantile(VecResults1(ValueTemp,1),0.25) quantile(VecResults1(ValueTemp,1),0.75) median(VecResults2(ValueTemp2,1)) quantile(VecResults2(ValueTemp2,1),0.25) quantile(VecResults2(ValueTemp2,1),0.75) ValueTemp4 ValueTemp3Temp];
VecResultsTemp4=[VecResultsTemp4;mean(VecResults1(ValueTemp,1)) sqrt(var(VecResults1(ValueTemp,1))) NaN mean(VecResults2(ValueTemp2,1)) sqrt(var(VecResults2(ValueTemp2,1))) NaN ValueTemp4 ValueTemp3Temp];

VecColor=[76 183 43;212 48 196;76 183 43;212 48 196];
VecColor2=[0 0 0;0 0 0];
VecValueTemp=NaN(4,2);
VecValueTemp2=[1 2 4 5];
ValueWidth=0.25;
ValueWidth2=0.19;
ValueWidth=ValueWidth/3;
ValueWidth2=ValueWidth2/3;
figure1 = figure;
axes1 = axes('Parent',figure1,...
    'XTickLabel',{'With the 190 editors','With the 306 editors'},...
    'XTick',[1.5 4.5],...
    'LineWidth',2,...
    'FontSize',24);
hold(axes1,'all');
for n2=1:4
    if n2<=2
        eval(sprintf('VecResults1Temp=VecResults%d;',n2));
    else
        eval(sprintf('VecResults1Temp=VecResults%d2;',n2-2));
    end
    ValueTemp=find(isnan(VecResults1Temp(:,1))==0);
    VecValueTemp(n2,1)=mean(VecResults1Temp(ValueTemp,1));
    VecValueTemp(n2,2)=sqrt(var(VecResults1Temp(ValueTemp,1)))/sqrt(size(ValueTemp,1));
    h(n2)=bar(VecValueTemp2(1,n2),VecValueTemp(n2,1),0.5);
    hold on
    VecValueFigureX2=VecValueTemp2(1,n2)-ValueWidth2:0.0001:VecValueTemp2(1,n2)+ValueWidth2;
    VecValueFigureY2=repmat(VecValueTemp(n2,1)-VecValueTemp(n2,2),1,size(VecValueFigureX2,2));
    VecValueFigureX3=VecValueTemp2(1,n2)-ValueWidth2:0.0001:VecValueTemp2(1,n2)+ValueWidth2;
    VecValueFigureY3=repmat(VecValueTemp(n2,1)+VecValueTemp(n2,2),1,size(VecValueFigureX3,2));
    VecValueFigureY4=VecValueTemp(n2,1)-VecValueTemp(n2,2):0.0001:VecValueTemp(n2,1)+VecValueTemp(n2,2);
    VecValueFigureX4=repmat(VecValueTemp2(1,n2),1,size(VecValueFigureY4,2));
    line(VecValueFigureX2,VecValueFigureY2,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
    line(VecValueFigureX3,VecValueFigureY3,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
    line(VecValueFigureX4,VecValueFigureY4,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
end
for n1=1:size(VecColor,1)
    set(h(n1),{'facecolor'},{VecColor(n1,:)/255});
end
ylabel('Duration as editor at Nature (year)','fontsize',30)
legend([h(1) h(2)],'Job offers with postdoc experience preferred','Job offers without such specification','Location','EastOutside')
set(gca,'Box','off')

ValueTemp=find(isnan(VecResults1(:,2))==0);
ValueTemp2=find(isnan(VecResults2(:,2))==0);
[ValueTemp5,ValueTemp6]=ttest2(VecResults1(ValueTemp,2),VecResults2(ValueTemp2,2));
[ValueTemp5Temp,ValueTemp6Temp]=ranksum(VecResults1(ValueTemp,2),VecResults2(ValueTemp2,2));
VecResultsTemp4=[VecResultsTemp4;median(VecResults1(ValueTemp,2)) quantile(VecResults1(ValueTemp,2),0.25) quantile(VecResults1(ValueTemp,2),0.75) median(VecResults2(ValueTemp2,2)) quantile(VecResults2(ValueTemp2,2),0.25) quantile(VecResults2(ValueTemp2,2),0.75) ValueTemp6 ValueTemp5Temp];
VecResultsTemp4=[VecResultsTemp4;mean(VecResults1(ValueTemp,2)) sqrt(var(VecResults1(ValueTemp,2))) NaN mean(VecResults2(ValueTemp2,2)) sqrt(var(VecResults2(ValueTemp2,2))) NaN ValueTemp6 ValueTemp5Temp];

figure1 = figure;
axes1 = axes('Parent',figure1,...
    'XTickLabel',{'With the 190 editors','With the 306 editors'},...
    'XTick',[1.5 4.5],...
    'LineWidth',2,...
    'FontSize',24);
hold(axes1,'all');
for n2=1:4
    if n2<=2
        eval(sprintf('VecResults1Temp=VecResults%d;',n2));
    else
        eval(sprintf('VecResults1Temp=VecResults%d2;',n2-2));
    end
    ValueTemp=find(isnan(VecResults1Temp(:,2))==0);
    VecValueTemp(n2,1)=mean(VecResults1Temp(ValueTemp,2));
    VecValueTemp(n2,2)=sqrt(var(VecResults1Temp(ValueTemp,2)))/sqrt(size(ValueTemp,1));
    h(n2)=bar(VecValueTemp2(1,n2),VecValueTemp(n2,1),0.5);
    hold on
    VecValueFigureX2=VecValueTemp2(1,n2)-ValueWidth2:0.0001:VecValueTemp2(1,n2)+ValueWidth2;
    VecValueFigureY2=repmat(VecValueTemp(n2,1)-VecValueTemp(n2,2),1,size(VecValueFigureX2,2));
    VecValueFigureX3=VecValueTemp2(1,n2)-ValueWidth2:0.0001:VecValueTemp2(1,n2)+ValueWidth2;
    VecValueFigureY3=repmat(VecValueTemp(n2,1)+VecValueTemp(n2,2),1,size(VecValueFigureX3,2));
    VecValueFigureY4=VecValueTemp(n2,1)-VecValueTemp(n2,2):0.0001:VecValueTemp(n2,1)+VecValueTemp(n2,2);
    VecValueFigureX4=repmat(VecValueTemp2(1,n2),1,size(VecValueFigureY4,2));
    line(VecValueFigureX2,VecValueFigureY2,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
    line(VecValueFigureX3,VecValueFigureY3,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
    line(VecValueFigureX4,VecValueFigureY4,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
end
for n1=1:size(VecColor,1)
    set(h(n1),{'facecolor'},{VecColor(n1,:)/255});
end
ylabel('Duration of editors'' academic research experience (year)','fontsize',30)
legend([h(1) h(2)],'Job offers with postdoc experience preferred','Job offers without such specification','Location','EastOutside')
set(gca,'Box','off')

ValueTemp=find(isnan(VecResults1(:,3))==0);
ValueTemp2=find(isnan(VecResults2(:,3))==0);
[ValueTemp5,ValueTemp6]=ttest2(VecResults1(ValueTemp,3),VecResults2(ValueTemp2,3));
[ValueTemp5Temp,ValueTemp6Temp]=ranksum(VecResults1(ValueTemp,3),VecResults2(ValueTemp2,3));
VecResultsTemp4=[VecResultsTemp4;median(VecResults1(ValueTemp,3)) quantile(VecResults1(ValueTemp,3),0.25) quantile(VecResults1(ValueTemp,3),0.75) median(VecResults2(ValueTemp2,3)) quantile(VecResults2(ValueTemp2,3),0.25) quantile(VecResults2(ValueTemp2,3),0.75) ValueTemp6 ValueTemp5Temp];
VecResultsTemp4=[VecResultsTemp4;mean(VecResults1(ValueTemp,3)) sqrt(var(VecResults1(ValueTemp,3))) NaN mean(VecResults2(ValueTemp2,3)) sqrt(var(VecResults2(ValueTemp2,3))) NaN ValueTemp6 ValueTemp5Temp];

figure1 = figure;
axes1 = axes('Parent',figure1,...
    'XTickLabel',{'With all co-authors','With the first group of co-authors'},...
    'XTick',[1.5 4.5],...
    'LineWidth',2,...
    'FontSize',24);
hold(axes1,'all');
for n2=1:4
    if n2<=2
        eval(sprintf('VecResults1Temp=VecResults%d;',n2));
    else
        eval(sprintf('VecResults1Temp=VecResults%d2;',n2-2));
    end
    ValueTemp=find(isnan(VecResults1Temp(:,3))==0);
    VecValueTemp(n2,1)=mean(VecResults1Temp(ValueTemp,3));
    VecValueTemp(n2,2)=sqrt(var(VecResults1Temp(ValueTemp,3)))/sqrt(size(ValueTemp,1));
    h(n2)=bar(VecValueTemp2(1,n2),VecValueTemp(n2,1),0.5);
    hold on
    VecValueFigureX2=VecValueTemp2(1,n2)-ValueWidth2:0.0001:VecValueTemp2(1,n2)+ValueWidth2;
    VecValueFigureY2=repmat(VecValueTemp(n2,1)-VecValueTemp(n2,2),1,size(VecValueFigureX2,2));
    VecValueFigureX3=VecValueTemp2(1,n2)-ValueWidth2:0.0001:VecValueTemp2(1,n2)+ValueWidth2;
    VecValueFigureY3=repmat(VecValueTemp(n2,1)+VecValueTemp(n2,2),1,size(VecValueFigureX3,2));
    VecValueFigureY4=VecValueTemp(n2,1)-VecValueTemp(n2,2):0.0001:VecValueTemp(n2,1)+VecValueTemp(n2,2);
    VecValueFigureX4=repmat(VecValueTemp2(1,n2),1,size(VecValueFigureY4,2));
    line(VecValueFigureX2,VecValueFigureY2,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
    line(VecValueFigureX3,VecValueFigureY3,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
    line(VecValueFigureX4,VecValueFigureY4,'LineWidth',3,'color',VecColor2(1,:)/255);
    hold on
end
for n1=1:size(VecColor,1)
    set(h(n1),{'facecolor'},{VecColor(n1,:)/255});
end
ylabel('Editors'' N articles as first author','fontsize',30)
legend([h(1) h(2)],'Job offers with postdoc experience preferred','Job offers without such specification','Location','EastOutside')
set(gca,'Box','off')

ValueTemp=find(isnan(VecResults1(:,1))==0&isnan(VecResults1(:,2))==0&isnan(VecResults1(:,3))==0);
ValueTemp2=find(isnan(VecResults2(:,1))==0&isnan(VecResults2(:,2))==0&isnan(VecResults2(:,3))==0);
VecValueTemp=[VecResults1(ValueTemp,1:3) 2*ones(size(ValueTemp,1),1);VecResults2(ValueTemp2,1:3) ones(size(ValueTemp2,1),1)];
[ValueResults,ValueResultsTemp,stats]=mnrfit(VecValueTemp(:,1:3),VecValueTemp(:,4));
ValueResultsTemp=[stats.beta-1.96*stats.se stats.beta+1.96*stats.se];

